<link href="{{ asset("bundles/AssetsUpload/MyUpload/my.css") }}" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{{ asset("bundles/AssetsUpload/MyUpload/my.js")}}"></script>
<script>
    $(function () {
        $(".MyUpload_box").on("change",".MyUpload_input", function () {
            var id = $(this).attr("id");
            $.ajaxFileUpload
            ({
                url: '{{ path("MyWebPicUpload") }}?name=' + id,
                secureuri: false, //是否需要安全协议，一般设置为false
                fileElementId:id, //文件上传域的ID
                dataType: 'json',
                success: function (data, status)
                {
                    if (data.s == 1) {
                        var picUrl =  data.d;
                        console.info(picUrl);
                        $("#preview_" + id).attr("src",picUrl).parent().show();
                        $("#hidden_" + id).val(picUrl);
                        $("#" + id).attr("name","");
                    }else {
                        alert("系统错误");
                    }
                },
                error: function (data, status, e)
                {
                    alert(e);
                }
            })
        });
    });
</script>
{#jquery依赖库请自行引入，需支持on语法#}